package zqkcom.atguigu.dao.impl;

import zqkcom.atguigu.bean.OrderItem;
import zqkcom.atguigu.dao.BaseDao;
import zqkcom.atguigu.dao.OrderItemDao;

import java.util.List;

public class OrderItemDaoImpl extends BaseDao<OrderItem> implements OrderItemDao {
    @Override//保存订单项
    public void saveOrderItem(OrderItem orderItem) {
        String sql = "insert into bs_orderItem values(null,?,?,?,?,?,?,?)";
        update(sql, orderItem.getTitle(), orderItem.getAuthor(), orderItem.getPrice(), orderItem.getImgPath(), orderItem.getCount(), orderItem.getAmount(), orderItem.getOrderId());


    }

    @Override
    //获取的订单详情
    public List<OrderItem> getDetails(String orderId) {
        String sql = "select * from bs_orderItem where orderId = ? ";
        return getBeanList(OrderItem.class, sql, orderId);
    }
}
